import { Injectable } from '@angular/core';
import { HttpClient } from "../../../../../providers/httpClient";
import { Config } from '../../../providers/config';

@Injectable()
export class InfoDetailService {
	constructor(
    public httpClient: HttpClient
	) { }


   //获取报告评论
   getCommontInfo() {
    let postBody = {
      "module": "KSB",
      "method": "IRM_A02_0380",
      "type":"IRM",
      "format":"json",
      "params": {
        "reportid":"11847379"
      }
    };
    return this.httpClient.post(postBody, {
      isShowLoading: true,
      isAlterError: false
    });
  }

  //获取外部报告附件
  getreportFile() {
    let postBody = {
      "module": "KSB",
      "method": "IRM_A02_0390",
      "type":"IRM",
      "format":"json",
      "params": {
        "reportid":"11847379"
      }
    };
    return this.httpClient.post(postBody, {
      isShowLoading: true,
      isAlterError: false
    });
  }

  //获取登录人的orgid
  getOrgid(username) {
    let postBody = {
      "module": "KSB",
      "method": "IRM_A02_0010",
      "type":"USP",
      "format":"json",
      "params": {
        "logonname":username
      }
    };
    return this.httpClient.post(postBody, {
      isAlterError: false
    });
  }

  //插入评论
  insertCommont(entry,objid=4412636,orgid=999010813) {
    let postBody = {
      "module": "KSB",
      "method": "IRM_A02_0420",
      "type":"IRM",
      "format":"json",
      "params": {
        "objid":objid,
        "orgid":orgid,
        "reportid":"11847379",
        "content":entry
      }
    };
    return this.httpClient.post(postBody, {
      isShowLoading: true,
      isAlterError: false
    });
  }

}
